�?!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
            $db=new PDO("mysql:host=localhost;dbname=webdb", "webap", "t0255",array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));

//            $db->exec("SET NAMES 'utf8'");
//            $db->exec("SET CHARACTER_SET_CLIENT=utf8");
//            $db->exec("SET CHARACTER_SET_RESULTS=utf8");

              $db->exec("SET NAMES 'utf8'");
//              $db->exec("insert into sps_deeds_main values('". md5(uniqid()) . "','t0255','dept_id','¤¤¤�?456','2010-10-10','test','´�?);
//              $st=$db->prepare("replace into sps_deeds_main values('". md5(uniqid()) . "','t0255','dept_id','¤¤¤�?456','2010-10-10','test','test2')");
            $st=$db->prepare("replace into sps_deeds_main values(:deeds_id,:app_empno,:dept_id,:deeds_winners,:deeds_instructor,:deeds_date,:deeds_desc,:deeds_notes)");

//                          $st=$db->prepare("replace into test values(?,?,?)");

//            $st->execute(array(md5(uniqid()),
//                          "����5",
//                          "456"));
//            $st=$db->prepare("replace into sps_deeds_main values(?,?,?,?,?,?,?,?)");
//
//            $st->execute(array(md5(uniqid()),
//                          "t0255",
//                          "b01",
//                          "¤¤¤�?
//                          "456",
//                          "2010-10-10",
//                          "798",
//                          "741"));

            $data= array(":deeds_id"=>md5(uniqid()),
                          ":app_empno"=>"t0255",
                          ":dept_id"=>"b01",
                          ":deeds_winners"=>"中文7",
                          ":deeds_instructor"=>"456",
                          ":deeds_date"=>"2010-10-10",
                          ":deeds_desc"=>"798",
                          ":deeds_notes"=>"741");
//
//            for($i=1;$i<count($data);$i++){
//                $st->bindParam($i, $data[$i]);
//                echo "$i data==>".$data[$i];
//            }
//
            foreach ($data as $key => $value){
                $st->bindParam($key, $data[$key]);
                echo "$key==>$value</br>";
            }
//            $st->bindValue(":deeds_id", "64ff0b2f5a4fdb7e4683dca649ff3ed0");
//            $st->bindValue(":app_empno", "t0255");
//            $st->bindValue(":dept_id", "a01");
//            $st->bindValue(":deeds_winners", "123");
//            $st->bindValue(":deeds_instructor", "456");
//            $st->bindValue(":deeds_date", "2010-10-10");
//            $st->bindValue(":deeds_desc", "787");
//            $st->bindValue(":deeds_notes", "741");

            $st->execute();
//
            print_r($st->errorInfo());
        ?>
    </body>
</html>
